package org.example.dept.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.dept.entity.vo.DeptVO;
import org.example.dept.repository.DeptRepository;
import org.example.dept.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
    private final DeptRepository deptRepository;

    public DeptServiceImpl(DeptRepository deptRepository) {
        this.deptRepository = deptRepository;
    }

    @Override
    public List<DeptVO> list() {
        return deptRepository.list();
    }
    @Override
    public List deptl() {
        return deptRepository.list();
    }

    @Override
    public PageInfo listbypage(int PageNumber, int PageSize) {
        PageHelper.startPage(PageNumber,PageSize);
        PageInfo<DeptVO> pageInfo = new PageInfo<>(deptRepository.listbypage( PageNumber, PageSize));
        return pageInfo;
    }

    @Override
    public List<DeptVO> getcollegelist() {
        return deptRepository.getcollegelist();
    }
    @Override
    public List<DeptVO> getMajor(Integer parent_id) {
        return deptRepository.getMajor(parent_id);
    }

}
